<template>
    <div class="sceenEarth" :id="id"></div>
</template>

<script>
export default {
    props: {config:Object, shared: {type: Boolean, default: false}},
    data(){
        return {
            id: "sceenEarth_" + new Date().getTime()
        }
    },
    mounted (){
      let _this = this
      let CGSGlobeSDKLoader = window.CGSGlobeSDKLoader
      CGSGlobeSDKLoader.accessToken = this.$props.config.accessToken

      // 如果是离线版本，请修改 baseUrl 为当前使用的地址
      CGSGlobeSDKLoader.baseUrl = this.$props.config.baseUrl
      CGSGlobeSDKLoader.load(success, fail, '', 'white')
      function success() {
        let CGSGlobe = window.CGSGlobe
        let app = new CGSGlobe.App({
          container: _this.id,
          appID: _this.$props.config.appID,
        })

        app.on("load", function () {
        //   new CGS.Widget.UtilsProject()
        })
      }

      function fail(e) {
        console.log(e)
      }
    },
    methods:{
      resize(newHPx, newWPx){
        // console.log(newHPx, newWPx)
      }
    }
    
}
</script>

<style scoped>
.sceenEarth{
    width: 100%;
    height: 100%;
}
</style>